package com.spddr.pmos.repos;

import java.util.List;

import org.joda.time.LocalDate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.spddr.pmos.jpa.Trade;

public interface TradeRepos extends JpaRepository<Trade, Long> {
	List<Trade> findByProgramId(long program);

	@Query(value = "SELECT * FROM trade_info WHERE start_date >= ? AND end_date < ?", nativeQuery = true)
	List<Trade> findByExecuting(LocalDate occur);

	@Query(value = "SELECT * FROM trade_info WHERE end_date < ?", nativeQuery = true)
	List<Trade> findByIncomplete(LocalDate occur);
}
